/*
 * ============================================================================
 *                   GNU Lesser General Public License
 * ============================================================================
 *
 *
 *
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
 *
 *
 *
 */
package rad.framework.search.service;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.jboss.seam.annotations.Name;

/**
 * Wraps information about the returned object from the search result.
 * 
 * @author boudyacho
 */
@Name("searchResult")
public class SearchResult {
	private String url;
	private String title;
	private String summary;
	private String id;
	private String num;
	// TODO score

	/**
	 * Constructor for SearchResult that contains information about the entity that
	 * was found in the search.
	 * 
	 * @param resultURL the url you want the search result to point to
	 * @param resultTitle the title is the text that will be linked.
	 * @param resultDescription a short description about the resulted entity
	 * @param resultId the id of the entity
	 * @param num the number in the list this searchResult will fit (1,2,3...11,etc)
	 * */
	public SearchResult(String resultUrl, String resultTitle,
			String resultDescription, String resultId, int num) {
		this.url = resultUrl;
		this.title = resultTitle;
		this.summary = resultDescription;
		this.id = resultId;
		this.num = Integer.toString(num);
	}
	
	/**
	 * @return the URL where the result information is.
	 * */
	public String getUrl() {
		return url;
	}
	
	/**
	 * @param url the URL where the result information is
	 * */
	public void setUrl(String url) {
		this.url = url;
	}
	
	/**
	 * @return the title or the text that will be linked in the search result.
	 * */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title the text that will be linked in the search result.
	 * */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return summary the summary is a small amount of text that better describes
	 * the information about the returned result.
	 * */
	public String getSummary() {
		return summary;
	}

	/**
	 * @param summary a small amount of text that better describes
	 * the information about the returned result.
	 * */
	public void setSummary(String summary) {
		this.summary = summary;
	}

	/**
	 * @return id of the object
	 * */
	public String getId() {
		return this.id;
	}

	/**
	 * @param id the string value of the returned searchResult's id.
	 * */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @param id the long value of the returned searchResult's id
	 * */
	public void setId(long id) {
		this.id = Long.toString(id);
	}
	
	/**
	 * @return num gets the number this searchResult represents in the total list of search results.
	 * */
	public String getNum() {
		return num;
	}
	
	/**
	 * @param num set's the number this searchResult represents in the total list of search results. 
	 * */
	public void setNum(String num) {
		this.num = num;
	}

	/**
	 * @param num set's the number this searchResult represents in the total list of search results.
	 * */
	public void setNum(int num) {
		this.num = Integer.toString(num);
	}
	
	/**
	 * the string representation of the searchResult.
	 * */
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}
}
